/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Form;

import DAL.ConnectionDB;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;

/**
 *
 * @author Pham
 */
public class JFrameMain extends javax.swing.JFrame {

    /**
     * Creates new form JFrameMain
     */
    public JFrameMain() {
        initComponents();
        
        //set icon for button
        setIcon();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private void initComponents() {//GEN-BEGIN:initComponents

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        btnLogin = new javax.swing.JButton();
        btnLogout = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        btnExit = new javax.swing.JButton();
        btnChangePass = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        btnManageManu = new javax.swing.JButton();
        btnManagePro = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        btnManageImport = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JSeparator();
        btnManageOrder = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        btnStatisticInventory = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JSeparator();
        btnStatisticImport = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JSeparator();
        btnStatisticExport = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        btnReportRevenue = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        btnTutorial = new javax.swing.JButton();
        btnVersion = new javax.swing.JButton();
        pnShow = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTabbedPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jTabbedPane1.setFocusCycleRoot(true);

        btnLogin.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnLogin.setForeground(new java.awt.Color(0, 102, 51));
        btnLogin.setText("Đăng nhập");
        btnLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoginActionPerformed(evt);
            }
        });

        btnLogout.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnLogout.setForeground(new java.awt.Color(0, 0, 153));
        btnLogout.setText("Đăng xuất");
        btnLogout.setEnabled(false);
        btnLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLogoutActionPerformed(evt);
            }
        });

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        btnExit.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnExit.setForeground(new java.awt.Color(153, 0, 0));
        btnExit.setText("Thoát chương trình");
        btnExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExitActionPerformed(evt);
            }
        });

        btnChangePass.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnChangePass.setForeground(new java.awt.Color(102, 102, 0));
        btnChangePass.setText("Đổi mật khẩu");
        btnChangePass.setEnabled(false);
        btnChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnChangePassActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnChangePass)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnLogout, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(54, 54, 54)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnExit)
                .addContainerGap(343, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(jSeparator1)
                    .addComponent(btnExit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnChangePass, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnLogout, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Hệ thống", jPanel2);

        btnManageManu.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnManageManu.setForeground(new java.awt.Color(0, 102, 51));
        btnManageManu.setText("Hãng sản xuất");
        btnManageManu.setEnabled(false);
        btnManageManu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnManageManuActionPerformed(evt);
            }
        });

        btnManagePro.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnManagePro.setForeground(new java.awt.Color(0, 102, 51));
        btnManagePro.setText("Sản phẩm");
        btnManagePro.setEnabled(false);
        btnManagePro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnManageProActionPerformed(evt);
            }
        });

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

        btnManageImport.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnManageImport.setForeground(new java.awt.Color(0, 102, 51));
        btnManageImport.setText("Phiếu nhập");
        btnManageImport.setEnabled(false);
        btnManageImport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnManageImportActionPerformed(evt);
            }
        });

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        btnManageOrder.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnManageOrder.setForeground(new java.awt.Color(0, 102, 51));
        btnManageOrder.setText("Đơn hàng");
        btnManageOrder.setEnabled(false);
        btnManageOrder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnManageOrderActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnManageManu, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnManagePro, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnManageImport, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnManageOrder, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(359, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnManageManu, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(btnManagePro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jSeparator2)
                    .addComponent(btnManageImport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jSeparator3)
                    .addComponent(btnManageOrder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Quản lý", jPanel3);

        btnStatisticInventory.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnStatisticInventory.setForeground(new java.awt.Color(0, 102, 51));
        btnStatisticInventory.setText("Tồn kho");
        btnStatisticInventory.setEnabled(false);
        btnStatisticInventory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStatisticInventoryActionPerformed(evt);
            }
        });

        jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL);

        btnStatisticImport.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnStatisticImport.setForeground(new java.awt.Color(0, 102, 51));
        btnStatisticImport.setText("Số lượng SP đã nhập");
        btnStatisticImport.setEnabled(false);
        btnStatisticImport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStatisticImportActionPerformed(evt);
            }
        });

        jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL);

        btnStatisticExport.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnStatisticExport.setForeground(new java.awt.Color(0, 102, 51));
        btnStatisticExport.setText("Số lượng SP đã bán");
        btnStatisticExport.setEnabled(false);
        btnStatisticExport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStatisticExportActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnStatisticInventory, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnStatisticImport, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnStatisticExport, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(451, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnStatisticInventory, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(jSeparator4)
                    .addComponent(btnStatisticImport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jSeparator5)
                    .addComponent(btnStatisticExport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Thống kê", jPanel4);

        btnReportRevenue.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnReportRevenue.setForeground(new java.awt.Color(0, 102, 51));
        btnReportRevenue.setText("Báo cáo doanh thu");
        btnReportRevenue.setEnabled(false);
        btnReportRevenue.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnReportRevenueActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnReportRevenue)
                .addContainerGap(792, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnReportRevenue, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Báo cáo", jPanel5);

        btnTutorial.setText("Hướng dẫn sử dụng");

        btnVersion.setText("Phiên bản");
        btnVersion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVersionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnTutorial, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnVersion, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(667, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnTutorial, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(btnVersion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Trợ giúp", jPanel6);

        pnShow.setEnabled(false);
        pnShow.setPreferredSize(new java.awt.Dimension(960, 540));

        javax.swing.GroupLayout pnShowLayout = new javax.swing.GroupLayout(pnShow);
        pnShow.setLayout(pnShowLayout);
        pnShowLayout.setHorizontalGroup(
            pnShowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        pnShowLayout.setVerticalGroup(
            pnShowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 540, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
            .addComponent(pnShow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnShow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }//GEN-END:initComponents

    private void btnManageManuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManageManuActionPerformed
        
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelManageManufacture manu = new JPanelManageManufacture();
        manu.setSize(new Dimension(940, 550));
        pnShow.add(manu);
        revalidate();
    }//GEN-LAST:event_btnManageManuActionPerformed

    private void btnManageProActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManageProActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelManageProduct pn = new JPanelManageProduct();
        pn.setSize(new Dimension(940, 550));
        pnShow.add(pn);
        revalidate();
    }//GEN-LAST:event_btnManageProActionPerformed

    private void btnManageImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManageImportActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelMangeImport pnImport = new JPanelMangeImport();
        pnImport.setSize(new Dimension(940, 560));
        pnShow.add(pnImport);
        //revalidate();
    }//GEN-LAST:event_btnManageImportActionPerformed

    private void btnManageOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManageOrderActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelManageOrder pnOrder = new JPanelManageOrder();
        pnOrder.setSize(new Dimension(940, 560));
        pnShow.add(pnOrder);
        //revalidate();
    }//GEN-LAST:event_btnManageOrderActionPerformed

    private void btnStatisticInventoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStatisticInventoryActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelInventory pn = new JPanelInventory();
        pn.setSize(new Dimension(940, 560));
        pnShow.add(pn);
        //revalidate();
    }//GEN-LAST:event_btnStatisticInventoryActionPerformed

    private void btnStatisticImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStatisticImportActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelStatisticImport panel = new JPanelStatisticImport();
        panel.setSize(new Dimension(940, 560));
        pnShow.add(panel);
        //revalidate();
    }//GEN-LAST:event_btnStatisticImportActionPerformed

    private void btnStatisticExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStatisticExportActionPerformed
        
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        JPanelStatisticExport panel = new JPanelStatisticExport();
        panel.setSize(new Dimension(940, 560));
        pnShow.add(panel);
        //revalidate();
    }//GEN-LAST:event_btnStatisticExportActionPerformed

    private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
        JDialogLogin dialog = new JDialogLogin(this, true);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        dialog.setLocation((dim.width - dialog.getWidth())/2, (dim.height - dialog.getHeight())/2);
        dialog.setVisible(true);
    }//GEN-LAST:event_btnLoginActionPerformed

    private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogoutActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        
        btnLogin.setEnabled(true);
        btnChangePass.setEnabled(false);
        btnLogout.setEnabled(false);
        btnManageImport.setEnabled(false);
        btnManageManu.setEnabled(false);
        btnManageOrder.setEnabled(false);
        btnManagePro.setEnabled(false);
        btnReportRevenue.setEnabled(false);
        btnStatisticExport.setEnabled(false);
        btnStatisticImport.setEnabled(false);
        btnStatisticInventory.setEnabled(false);
    }//GEN-LAST:event_btnLogoutActionPerformed

    private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
        int quesstion = JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn tắt chương trình?", "Thống báo", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if(quesstion == JOptionPane.YES_OPTION)
        {
            System.exit(0);
        }
    }//GEN-LAST:event_btnExitActionPerformed

    private void btnReportRevenueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReportRevenueActionPerformed
        pnShow.removeAll();
        pnShow.revalidate();
        pnShow.repaint();
        
        JPanelReportRevenue panel = new JPanelReportRevenue();
        panel.setSize(new Dimension(940, 560));
        pnShow.add(panel);
    }//GEN-LAST:event_btnReportRevenueActionPerformed

    private void btnVersionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVersionActionPerformed
        JDialogVersion dialog = new JDialogVersion(this, true);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        dialog.setLocation((dim.width - dialog.getWidth())/2, (dim.height - dialog.getHeight())/2);
        dialog.setVisible(true);
    }//GEN-LAST:event_btnVersionActionPerformed

    private void btnChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChangePassActionPerformed
        JDialogChangePassword dialog = new JDialogChangePassword(this, true);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        dialog.setLocation((dim.width - dialog.getWidth())/2, (dim.height - dialog.getHeight())/2);
        dialog.setVisible(true);
    }//GEN-LAST:event_btnChangePassActionPerformed
    
    /**
     * @param args the command line arguments
     */
    private ImageIcon resizeImg(ImageIcon imgIc, int width, int height)
    {
        if(imgIc != null){
             Image img = imgIc.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH);
             ImageIcon newIcon = new ImageIcon(img);
             return newIcon;
        }
        return null;
    }
    
    private void setIcon()
    {
        btnLogin.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/login.png")), 60, 60));
        btnLogin.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnLogin.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnLogout.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/logout.png")), 60, 60));
        btnLogout.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnLogout.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnExit.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/exit.png")), 60, 60));
        btnExit.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnExit.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnManageManu.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/industry.png")), 60, 60));
        btnManageManu.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnManageManu.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnManagePro.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/laptop.png")), 60, 60));
        btnManagePro.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnManagePro.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnManageImport.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/import.png")), 60, 60));
        btnManageImport.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnManageImport.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnManageOrder.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/order.png")), 60, 60));
        btnManageOrder.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnManageOrder.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnStatisticInventory.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/Inventory.png")), 60, 60));
        btnStatisticInventory.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnStatisticInventory.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnStatisticImport.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/Inventory-import.png")), 60, 60));
        btnStatisticImport.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnStatisticImport.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnStatisticExport.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/export.png")), 60, 60));
        btnStatisticExport.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnStatisticExport.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnReportRevenue.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/report.png")), 60, 60));
        btnReportRevenue.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnReportRevenue.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnChangePass.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/keys.png")), 60, 60));
        btnChangePass.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnChangePass.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnVersion.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/version_cue.png")), 60, 60));
        btnVersion.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnVersion.setHorizontalTextPosition(SwingConstants.CENTER);
        
        btnTutorial.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/tutorials.png")), 60, 60));
        btnTutorial.setVerticalTextPosition(SwingConstants.BOTTOM);
        btnTutorial.setHorizontalTextPosition(SwingConstants.CENTER);
        
//        btnReportProfit.setIcon(resizeImg(new ImageIcon(JFrameMain.class.getResource("../ImageIcons/profit.png")), 60, 60));
//        btnReportProfit.setVerticalTextPosition(SwingConstants.BOTTOM);
//        btnReportProfit.setHorizontalTextPosition(SwingConstants.CENTER);
    }
    
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFrameMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrameMain frame = new JFrameMain();
                Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                frame.setLocation((dim.width - frame.getWidth())/2, (dim.height - frame.getHeight())/10);
                frame.setVisible(true);
                showLogin();
            }

            private void showLogin() {
                JDialogLogin dialog = new JDialogLogin(null, true);
                Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                dialog.setLocation((dim.width - dialog.getWidth())/2, (dim.height - dialog.getHeight())/2);
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JButton btnChangePass;
    private javax.swing.JButton btnExit;
    public static javax.swing.JButton btnLogin;
    public static javax.swing.JButton btnLogout;
    public static javax.swing.JButton btnManageImport;
    public static javax.swing.JButton btnManageManu;
    public static javax.swing.JButton btnManageOrder;
    public static javax.swing.JButton btnManagePro;
    public static javax.swing.JButton btnReportRevenue;
    public static javax.swing.JButton btnStatisticExport;
    public static javax.swing.JButton btnStatisticImport;
    public static javax.swing.JButton btnStatisticInventory;
    public static javax.swing.JButton btnTutorial;
    public static javax.swing.JButton btnVersion;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JPanel pnShow;
    // End of variables declaration//GEN-END:variables
}
